//
//  FenleiCell.m
//  Miss
//
//  Created by 军哥 on 15-1-29.
//  Copyright (c) 2015年 Alan. All rights reserved.
//

#import "FenleiCell.h"

@interface FenleiCell()

- (void)setFenlei_cell;
@end


@implementation FenleiCell
- (void)dealloc
{
    [_titleImage release];
    [_titleLabel release];
    [_pictureImage release];
    [_BackGview release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setFenlei_cell];
        
    }
    return self;
}

- (void)setFenlei_cell
{
    //最大的view
    self.BackGview = [[UIView alloc]init];
    //设置那个圆角的有多圆
    self.BackGview.layer.cornerRadius = 5;
    //反着 适应 圆边角
    self.BackGview.layer.masksToBounds = YES;
    
    [self.contentView addSubview:self.BackGview];
    [_BackGview release];
    
    //图片imageview
    self.pictureImage = [[UIImageView alloc]init];
    [self.BackGview addSubview:_pictureImage];
    [_pictureImage release];
    
    
    //副标题label
    self.titleLabel = [[UILabel alloc]init];
    [self.BackGview addSubview:self.titleLabel];
    [_titleLabel release];
    
    //图片标题imageview
    self.titleImage = [[UIImageView alloc]init];
    [self.pictureImage addSubview:self.titleImage];
    [_titleImage release];
    
    
    //最后统一删掉
    _BackGview.backgroundColor = [UIColor redColor];
    _pictureImage.backgroundColor = [UIColor cyanColor];
    _titleLabel.backgroundColor = [UIColor greenColor];
    _titleImage.backgroundColor = [UIColor yellowColor];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];

    
    _BackGview.frame = CGRectMake(10, 10, self.contentView.frame.size.width*2/3, self.contentView.frame.size.height-20);
    
    _pictureImage.frame = CGRectMake(0, 0, self.BackGview.frame.size.width, self.BackGview.frame.size.height*4/5);
    
    _titleLabel.frame = CGRectMake(0, self.BackGview.frame.size.height*4/5, self.BackGview.frame.size.width, self.BackGview.frame.size.height/5);
    
    _titleImage.frame = CGRectMake(10, 10, 100, self.pictureImage.frame.size.height/2);
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
